package ar.com.spsolutions.splibrary.library;

import ar.com.spsolutions.splibrary.notifiers.INotifier;
import ar.com.spsolutions.splibrary.user.User;

public class LibraryBuilder {

    private transient Library toBuild;

    private INotifier notifier;

    public LibraryBuilder(final INotifier aNotifier) {
        this.toBuild = new Library(aNotifier);
        this.notifier = aNotifier;
    }

    public LibraryBuilder withUser(final User value) {
        this.getToBuild().setUser(value);
        return this;
    }

    public Library build() {
        Library temp = this.getToBuild();
        this.toBuild = new Library(this.getNotifier());
        return temp;
    }

    private Library getToBuild() {
        return this.toBuild;
    }

    public INotifier getNotifier() {
        return this.notifier;
    }

    public void setNotifier(final INotifier notifier) {
        this.notifier = notifier;
    }
}
